package com.example.springbott.wx_controller;

import com.example.springbott.bean.BaseRespVo;
import com.example.springbott.bean.MarketUser;
import com.example.springbott.bean.silic.WXUserIndexOrderVo;
import com.example.springbott.wx_service.WXUserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户模块
 *
 * @author silic xia
 * @since 2022/11/22 11:47
 */

@RestController
@RequestMapping("wx/user")
public class WXUserController {

    @Autowired
    WXUserService wxUserService;

    /**
     *  展示index
     *
     * @param /null
     * @return order: {unrecv: 6, uncomment: 1, unpaid: 0, unship: 4} 需要sql语句求值
     *          errmsg: "成功"
     *          errno: 0
     * @author silic xia
     * @since 2022/11/22 11:53
     */
    @RequestMapping("index")
    public BaseRespVo wxUserIndex(){
        MarketUser user = (MarketUser) SecurityUtils.getSubject().getPrincipal();
        Integer userId = user.getId();
        WXUserIndexOrderVo data = wxUserService.wxUserIndex(userId);
        return BaseRespVo.ok(data);
    }


}

